<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <textarea v-model="text" @input="much"></textarea>
        <p v-if="text.length <= total">剩余字数: {{ zzz }}/{{ total }}</p>
    </div>
</body>
<script src="./vue.js"></script>
<script>
    const { createApp, ref, computed } = Vue
    createApp({
        setup(){
            const text = ref('')
            const total = 10
            const zzz = computed(() => total - text.value.length)
            function much() {

          }   
            return{
                text,
                total,
                zzz,
                much
            }
            // if(zzz=0){
            //     e.preventDefault()//阻止键盘事件
            // }
        }
        
    }).mount('#app')
        

</script>
</html>